<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>BhSy管理</title>
  <link rel="stylesheet" th:href="@{/css/AdminController.css}">
  <link rel="stylesheet" th:href="@{/bootstrap/css/bootstrap.min.css}" />
    <link rel="stylesheet" th:href="@{/css/BVideo.css}" />
</head>
<body>
    <div class="container-fluid bmTopDiv">
        <div class="col-md-1 bmTopLogoFont">
            <h3>BhSyVideo</h3>
        </div>
        <div class="col-md-2 bmTopXxDiv">
            <ul class="">
                <li class="bmToplif"><a style="text-decoration: none;color: white" th:href="@{/bhsy/theMain}"> 首页</a></li>
            </ul>
        </div>
    </div>
  <div class="adminCTopDiv">
      <ul>
        <li style="margin-left: 22%">申请管理</li>
        <li>商品管理</li>
        <li>评论管理</li>
        <li>用户管理</li>
        <li>视频管理</li>
      </ul>
  </div>
  <div class="adminViewDiv">

  </div>
</body>
<script th:src="@{/js/jquery-360.min.js}"></script>
<script>
  $(function () {
    var adminCTopDiv = document.getElementsByClassName("adminCTopDiv")[0];
    var aTopLi = adminCTopDiv.querySelectorAll("li");
    var userPwd = document.getElementsByClassName("userPwd");
    var aTopindex=0;
    for (let i = 0; i < aTopLi.length ; i++) {
        aTopLi[i].onclick = function () {
          aTopLi[aTopindex].style.backgroundColor="#4f84cf";
          aTopLi[i].style.backgroundColor="#2f66ac";
          aTopindex=i;
        }
    }
    var agreBtn = document.getElementsByClassName("agreBtn");
    for (let i = 0; i < agreBtn.length ; i++) {
      agreBtn[i].onclick = function () {
        ajaxSqGl(userPwd[i].innerText);
      }
    }
  })
  function ajaxSqGl(guid){
    $.ajax({
      url:"/Gos/ag/"+guid,
      method:"PUT",
      success:function (data) {
        var GosUser = data.map.GosUser;
        $(".adminViewDiv").empty();
        var adminViewDiv = document.getElementsByClassName("adminViewDiv")[0];
        for (let i = 0; i < GosUser.length ; i++) {
          var userMsgDiv = document.createElement("div");
          userMsgDiv.className="userMsgDiv";
          var userImg = document.createElement("img");
          userImg.className="userImg";
          userImg.src=GosUser[i].uImg;
          userMsgDiv.appendChild(userImg);
          var userNameMore = document.createElement("div");
          userNameMore.className="userNameMore";
          var userName = document.createElement("p");
          userName.className="userName";
          userName.innerText=GosUser[i].uName;
          var userPwd = document.createElement("p");
          userPwd.className="userPwd";
          userPwd.innerText=GosUser[i].uid;
          userNameMore.appendChild(userName);
          userNameMore.appendChild(userPwd);
          userMsgDiv.appendChild(userNameMore);
          if (GosUser[i].uVip==1){
            var userVipDiv = document.createElement("div");
            userVipDiv.className="userVipDiv";
            userVipDiv.innerText="大会员";
            userMsgDiv.appendChild(userVipDiv);
          }
          var agreBtn = document.createElement("input");
          agreBtn.type="button";
          agreBtn.setAttribute("value","同意");
          userMsgDiv.appendChild(agreBtn);
          adminViewDiv.appendChild(userMsgDiv);
        }
      }
    })
  }
</script>
</html>